<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Traits\CommonController;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Response;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests,CommonController;
    const SUCCESS_200 = "操作成功";
    const ERROR_2001 = "自定义错误";
    const ERROR_2002 = "登录失败，请检查用户名和密码";
    const ERROR_9999 = "系统错误,请联系系统管理员";
    const ERROR_2010 = "token验证出错";

    public $userInfo =[] ;
    public function error($message,$code=-1001) {
        return Response::returns([
            'code' =>  -1001,
            'status' => "error",
            'message' => $message??'操作失败!'
        ], 200);
    }
    public function success($message=null,$data=null) {
        return Response::returns([
            'code' =>  0,
            'status' => "success",
            'message' => $message??'成功操作!',
            'data' => $data??null
        ], 200);
    }
}
